package util

import "io/ioutil"

func FindOutFilesInDir(path string) map[string]string {
	nameAndPaths := make(map[string]string)
	fileInfos, _ := ioutil.ReadDir(path)
	for _, fileInfo := range fileInfos {
		if fileInfo.IsDir() {
			inPath := path + "/" + fileInfo.Name()
			inNameAndPaths := FindOutFilesInDir(inPath)
			for k, v := range inNameAndPaths {
				nameAndPaths[k] = v
			}
		} else {
			nameAndPaths[fileInfo.Name()] = path
		}
	}
	return nameAndPaths
}
